<!--
 * @Author
 * @Description: 
 * @Date: 2023-06-06 08:56:04
 * @LastEditTime: 2023-07-06 09:53:59
 * @FilePath: \vue3scaffold\src\views\auth\login.vue
 * @LastEditors: chenli chenli@kcwl.com
-->

<template>
  <el-input v-model="speakMessage"></el-input>
  <el-button @click="speakMsg" type="primary"> 播报 </el-button>
</template>
<script setup lang="ts">
import { ref } from "vue";
let speakMessage = ref<string>("你有一条新的车辆偏移预警");
let speakMsg = () => {
  if (!speakMessage.value) return;
  const synth = window.speechSynthesis;
  const msg = new SpeechSynthesisUtterance();

  msg.text = speakMessage.value;
  msg.lang = "zh-CN";
  msg.volume = 1;
  msg.rate = 1;
  msg.pitch = 1;
  synth.speak(msg);
};
</script>
